#include "timer.h"

#define ST_BASE (0xFFFFFD00)
#define ST_PIMR (volatile unsigned int*)(ST_BASE + 0x04)
#define ST_SR   (volatile unsigned int*)(ST_BASE + 0x10)
#define ST_IER  (volatile unsigned int*)(ST_BASE + 0x14)

#define PITS   (1 << 0) // period interval timer status

unsigned long jiffies;

//------------------------------------------------------------------------------
void init_timer()
{
  *ST_PIMR =   32768;
  /*reset System Timer*/
  *ST_SR;
  *ST_IER =  (1 << 0);
}
//------------------------------------------------------------------------------
int has_timer_raised_interrupt()
{
  return(*ST_SR & PITS);
}
//------------------------------------------------------------------------------

